﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TestVisioCanvas.Helpers;

using Visio = Microsoft.Office.Interop.Visio;

namespace TestVisioCanvas.Wrappers
{
    /// <summary>
    /// Encapsulates the standard Visio shape that represents a CAD drawing
    /// </summary>
    public class DWGShape: ManagedShape
    {
        /// <summary>
        /// Visio uses a bounding box for the CAD drawings that is 10% greater of the shape's size,
        /// both for width and height
        /// </summary>
        private static readonly double BoundingBoxScaling = 1.1;

        public DWGShape(Visio.Shape Shape, double Width, double Height) : base(Shape)
        {     
#warning gestire lo scaling del bounding box( nei dettagli prodotto le dimensioni devono essere quelle reali)
            base.Width = Width * BoundingBoxScaling;
            base.Height = Height * BoundingBoxScaling;
            
            // Enables to modify the dimensions
#warning In realtà un oggetto di quelli in vendita non dovrebbe poter essere ridimensionato liberamente
            
            // Enables to modify the position
            this.VisioShape.CellsU["LockMoveX"].set_Result(Visio.VisUnitCodes.visNoCast, 0);
            this.VisioShape.CellsU["LockMoveY"].set_Result(Visio.VisUnitCodes.visNoCast, 0);
            // Enables to remove the shape from the drawning surface
            this.VisioShape.CellsU["LockDelete"].set_Result(Visio.VisUnitCodes.visNoCast, 0);
            // Enables to rotate the shape
            this.VisioShape.CellsU["LockRotate"].set_Result(Visio.VisUnitCodes.visNoCast, 0);
        }        
    }
}
